package WaiBao;

import java.util.Arrays;

public class LiJingHua {
    public static void main(String[] args) {
        String[] name = {"张博天(班长)", "王鹏凯(副班长)", "小李(学习委员)", "李瑶(组织委员)", "张晓伟", "王自力", "刘恺威", "贾乃亮", "杨颖", "李戴", "胡慧珍", "文君",
                "王嘉尔", "杨幂", "杨明生", "合阳", "将华宇", "刘梅", "成龙", "李晓梅", "杜小兰", "莫言", "李静瑶", "胡橘芳", "王波", "贾平凹", "沈从文", "彭凯",
                "吴京", "李京华(团支书)"};//考生本人:李京华(团支书)
        int[] age = {21, 20, 19, 18,20, 19, 20, 20, 20, 19,21, 20, 18, 20, 20, 20, 20, 21, 18, 18, 20, 19, 21, 20, 20, 18, 21,20, 20,21};//考生年龄：21岁

        double[] jainhu1 = {90, 72, 90, 80, 75, 64, 78, 89, 80, 90, 60, 87, 84, 79, 61, 68, 69, 99, 96, 88, 92, 91, 95, 88, 75, 74, 79, 75, 81, 95};
        double[] jainhu2 = {83, 81, 69, 76, 81, 75, 88, 79, 90, 61, 91, 77, 82, 75, 66, 65, 76, 79, 66, 68, 92, 71, 95, 85, 75, 85, 75, 84, 91, 93};
        double[] jainhu3 = {75, 66, 70, 85, 75, 66, 78, 89, 80, 68, 63, 87, 85, 75, 95, 68, 69, 69, 96, 93, 92, 81, 95, 95, 79, 84, 76, 73, 82, 92};


        double black;//代表每个学生的总分
        double blue;//代表每个学生的平均分
//        for (int i = 0; i < 30; i++) {
//            black = jainhu1[i] + jainhu2[i] + jainhu3[i];
//            blue = (  black * 1.0) / 3;
//            System.out.println(name[i] + "的总分为:" + black);
//            System.out.println(name[i] + "的平均分为:" +blue);
//        }


//        double heiya = 0, haung = 0;
//        double[] juece = new double[30];
//        for (int i = 0; i < 30; i++) {
//            heiya  =jainhu1[i] + jainhu2[i] + jainhu3[i];
//            haung = (heiya * 1.0) / 3;
//            juece[i] = haung;
//        }
//
//        for (int i = 0; i < juece.length - 1; i++) {
//            for (int j = 0; j < juece.length - i - 1; j++) {
//                if (juece[j] < juece[j + 1]) {
//                    double tep = juece[j];
//                    juece[j] =juece[j + 1];
//                    juece[j + 1] = tep;
//                }
//            }
//        }
//        System.out.println("前十名同学的成绩为:");
//        for (int i = 0; i < 10; i++) {
//            System.out.println(juece[i]);
//        }

        double suan1 = 0,suan2 = 0, suan3 = 0;//计算每门课的平均分
        double fd1 = 0, fd2 = 0, fd3 = 0;//计算每门课标准差
        double mood1 = 0, mood2 = 0, mood3 = 0;//计算每门课中位数
        double sum2 = 0;
        for (int i = 0; i < jainhu1.length; i++) {
            sum2+=jainhu1[i];
        }
        suan1 = (sum2*1.0)/30;
        System.out.println("生物化学的班级平均分为:"+suan1);
        double Sum = 0;
        for (int i = 0; i < jainhu2.length; i++) {
            Sum+=jainhu2[i];
        }
        suan2 = (Sum*1.0)/30;
        System.out.println("微生物学的班级平均分为:"+suan2);
        double sum = 0;
        for (int i = 0; i <jainhu3.length; i++) {
            sum+=jainhu3[i];
        }
        suan3 = (sum*1.0)/30;
        System.out.println("人体组织解剖学的班级平均分为:"+suan3);



        double c1 = 0,c2 = 0,c3 = 0;
        for (int i = 0; i <jainhu1.length; i++) {
            c1+= (jainhu1[i] -suan1)*(jainhu1[i] - suan1);
        }
        fd1 = Math.sqrt(c1*1.0/30);
        System.out.println("生物化学的班级标准差为:"+fd1);

        for (int i = 0; i < jainhu2.length; i++) {
            c2+= (jainhu2[i] - suan2)*(jainhu2[i] - suan2);
        }
        fd2 = Math.sqrt(c2*1.0/30);
        System.out.println("微生物学的班级标准差为:"+fd2);

        for (int i = 0; i < jainhu3.length; i++) {
            c3+= (jainhu3[i] -suan3)*(jainhu3[i] - suan3);
        }
        fd3 = Math.sqrt(c3*1.0/30);
        System.out.println("人体组织解剖学的班级标准差为:"+fd3);
//////
//////
        Arrays.sort(jainhu1);
        Arrays.sort(jainhu2);
        Arrays.sort(jainhu3);
        mood1 =( jainhu1[14]+jainhu1[15])*1.0/2;
        mood2 =( jainhu2[14]+jainhu2[15])*1.0/2;
        mood3 =( jainhu3[14]+jainhu3[15])*1.0/2;
        System.out.println("生物化学的中位数为:"+mood1);
        System.out.println("微生物学的中位数为:"+mood2);
        System.out.println("人体组织解剖学的中位数为:"+mood3);

    }
}
